package gobeshona.emails;

import java.util.logging.Logger;

import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class GobeshonaEmailsResource extends ServerResource {
	private static final Logger log = Logger
			.getLogger(GobeshonaEmailsResource.class.getName());

	@Get
	public Representation testGetEmails() {
		UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        if (user != null){
    		return new StringRepresentation("User email: " + user.getEmail() + "; nick: " + user.getNickname() + " domain: " + user.getAuthDomain());
        }
        else{
        	return new StringRepresentation("no user at testGetEmails");
        }
	}
	
	//E-mail hook for smtp2web
	//iqbalyusufdipu@smtp2web.com
	/*
	 * 	User	Domain	POST URL	Actions
		gobeshona71 	smtp2web.com 	http://gobeshona71.appspot.com/emails
		router.attach("/emails",EmailResource.class);
	*/
}
